#ifndef _CMAN_H_
#define _CMAN_H_

#include "CWeapon.h"

class CMan : public CWeapon
{
private:
    bool m_bIsJumping;
    bool m_bIsRunning;
    float m_fMoveSpeed;
    float m_fJumpSpeed;
    float m_fCurrentSpeedX; // 现在使用基类的m_fSpeedX
    float m_fCurrentSpeedY; // 现在使用基类的m_fSpeedY
    float m_fGravity;
    int m_iJumpKeyState;
    bool m_bLeftPressed;
    bool m_bRightPressed;
    bool m_bCanJump;  // 添加这个成员变量声明

    void HandleDiCollision(CWeapon* pDi);
    void HandleDotCollision(CWeapon* pDot);

public:
    CMan(const char* szName);
    virtual ~CMan();

    virtual void Init();
    virtual void OnMove(float fDeltaTime);
    virtual void OnKeyDown(int iKey);
    virtual void OnKeyUp(int iKey);
    virtual void OnSpriteColSprite(CWeapon* pSprite);
    virtual void OnSpriteColWorldLimit(int iColSide);
     void SetCanJump(bool canJump) { m_bCanJump = canJump; }


    void Jump();
    void MoveLeft();
    void MoveRight();
    void Stop();



    // 重写速度设置方法
    virtual void SetCurrentSpeedX(float speed) override;
    virtual void SetCurrentSpeedY(float speed) override;


    void SetIsJumping(bool jumping) { m_bIsJumping = jumping; }
    bool IsJumping() const { return m_bIsJumping; }
};

#endif // _CMAN_H_
